package cn.zymall.goods.service.impl;

import cn.zymall.common.model.MerchantSpu;
import cn.zymall.goods.mapper.MerchantSpuMapper;
import cn.zymall.goods.service.MerchantSpuService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author lxh
 * @Description 店铺商品分类业务层接口实现类
 * @date 2020/8/24 19:50
 * @Classname MerchantSpuServiceImpl
 **/
@Service
public class MerchantSpuServiceImpl extends ServiceImpl<MerchantSpuMapper, MerchantSpu> implements MerchantSpuService {

	@Autowired
	private MerchantSpuMapper merchantSpuMapper;

	@Override
	public List<MerchantSpu> findAll(Integer id) {
		return merchantSpuMapper.findAll(id);
	}

	@Override
	public void add(MerchantSpu merchantSpu) {
		merchantSpuMapper.add(merchantSpu);
	}

	@Override
	public void amend(MerchantSpu merchantSpu) {
		merchantSpuMapper.amend(merchantSpu);
	}

	@Override
	public Integer countSpu(Integer id) {
		return merchantSpuMapper.countSpu(id);
	}

	@Override
	public void del(Integer id) {
		Integer integer = merchantSpuMapper.countSpu(id);
		if(integer>0){
			return;
		}
		merchantSpuMapper.del(id);
	}
}
